layui.use(['layer', 'form', 'admin', 'laydate', 'ax', 'formSelects'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    // 表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var handleRevert = $("#replyContent").val();
        var handleStatus = $("#status").find("option:selected").val();
        var id = $("#feedbackId").val();
        var data = {
            handleRevert: handleRevert,
            handleStatus: handleStatus,
            id: id
        }
        // 异步请求
        $.ajax({
            url: Feng.ctxPath + "/feedback/handle",
            data: JSON.stringify(data),
            type: "post",
            contentType: "application/json;charset=UTF-8",
            async: false,//关闭异步请求
            dataType: "json",
            success: function (data) {
                if (data.code == 200) {
                    Feng.success("处理成功！");
                    //传给上个页面，刷新table用
                    // window.parent.location.reload();
                    admin.putTempData('formOk', true);
                    //关掉对话框
                    admin.closeThisDialog();
                } else {
                    Feng.success("处理失败！" + data.message);
                }
            }
            ,
            error: function (data) {
                Feng.error("处理失败！" + data.message)
            }
        });
    });

    // 回显
    var handleStatus = $("#handleStatus").val();
    $('#status').find('option[value=' + handleStatus + ']').attr('selected', 'selected');
    form.render('select')

    // 按钮是否展示
    if ($("#handleStatus").val() == '1') {
        $("#_submit").attr("disabled", false);
    }
    if ($("#handleStatus").val() == '2') {
        $("#_submit").attr("disabled", true);
    }
    if ($("#handleStatus").val() == '3') {
        $("#_submit").attr(disabled, true);
    }


});



